package pri.orm.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import pri.orm.Service.IUserService;

import javax.annotation.Resource;

@Controller
@RestController
public class UserController {

    @Resource
    IUserService userService;

    @RequestMapping("exception")
    public String exception(){
        throw new ArithmeticException();
//        return "exception";
    }

    @RequestMapping("newUser")
    public String newUser(@RequestParam("userName") String userName){
        userService.newUser(userName);
        return userName;
    }

    @RequestMapping("newUser2")
    public String newUser2(@RequestParam("userName") String userName){
        userService.newUser2(userName);
        return userName;
    }
}
